export function request(url: string, data?: any, config?: any) {
	return new Promise<{ code: number; data: any; msg?: string; pagination?: object }>((resolve, reject) => {
		uni.request({
			// @ts-ignore
			url: import.meta.env.VITE_API_URL + url,
			data: data,
			method: config?.method || 'POST',
			header: {
				Authorization: 'Bearer ' + (uni.getStorageSync('token') ? uni.getStorageSync('token') : '')
			},
			success: (res: any) => {
				resolve(res.data);
			},
			fail: (err: any) => {
				reject(err);
			}
		});
	});
}
